<script>
function reSentEmail(){
	$.post('<?php echo CHtml::normalizeUrl(array('/site/reSentEmail'));?>',{'uid':'<?=$model->uid?>','email':'<?=$model->email?>'}, function (data) {
        var ret = $.parseJSON(data);
        if (ret != null && ret.success != null && ret.success) {
			alert(ret.msg);
        }
	});
}
</script>
<?php
$this->widget('webroot.admin.protected.extensions.fancybox.EFancyBox', array('target' => '.fan', 'config' => array('width' => 620, 'height' => 330,'type'=>'iframe','hideOnOverlayClick'=>false)));
$this->widget('webroot.admin.protected.extensions.fancybox.EFancyBox', array('target' => '.fan2', 'config' => array('width' => 520, 'height' => 330,'type'=>'iframe','hideOnOverlayClick'=>false)));
$this->widget('webroot.admin.protected.extensions.fancybox.EFancyBox', array('target' => '.tx', 'config' => array('width' => 520, 'height' => 180,'type'=>'iframe','hideOnOverlayClick'=>false,'onClosed'=>'js:function(){window.location.href="'.Yii::app()->createUrl("site/userinfo").'";}')));
?>
<div id="contener" _height="auto">
	<?php $this->beginWidget('application.widget.site.userLeftWidget'); ?>
	<?php $this->endWidget(); ?>
	<div class="main2">
		<?php $this->beginWidget('application.widget.site.newWidget'); ?>
		<?php $this->endWidget(); ?>
		<div class="right_mainBox">
			<div class="right_mainBox_top"></div>
			<div class="mainMenu"><img src="images/title08.png" width="726" height="23" alt="資料維護" title="資料維護" />
				<form action="" method="post">
					<div class="memberBOX">
						<?php
						if($model){
							$notice = $success?$success:CHtml::errorSummary($model, '請檢查以下錯誤：');
						}						
						if($notice){
						?>
						<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
								<td style="color:red;" <?php if($success){?> align="center"<?php }?> ><?=$notice?></td>
							</tr>
						</table>
						<?php
						}
						?>					
						<span class="title01">個人資訊</span>
						<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
								<td width="165" height="30" align="left" valign="middle" nowrap="nowrap">* 帳號 / ID ：</td>
								<td width="360" valign="middle">
									<input name="textfield" type="text" disabled="disabled" id="textfield" value="<?=$model->username?>" size="30" readonly="readonly" /></td>
								<td colspan="3" rowspan="8" align="center" valign="top"><div class="memberBOX_box"> <img src="<?=Yii::app()->params['avatarPath'].'/'.$model->avatar?>" alt="" width="100" height="100" border="0" />
										<div class="button"><a href="<?=Yii::app()->createUrl('site/changeAvatar')?>" class="tx" title="更換頭像" >更換頭像</a></div>
									</div></td>
							</tr>
							<tr>
								<td width="165" height="30" align="left" valign="middle" nowrap="nowrap">* 姓名 / Name ：</td>
								<td valign="middle"><label for="textfield2"></label>
									<input name="realname" type="text" id="realname" readonly="readonly" disabled="disabled" value="<?=$model->realname?>" size="30" /></td>
							</tr>
							<tr>
								<td width="165" height="30" align="left" valign="middle" nowrap="nowrap">* 密碼 / Password ：</td>
								<td valign="middle"><label for="textfield2"></label>
									<input name="password" type="password" id="password" readonly="readonly" disabled="disabled" value="<?=$model->password?>" size="30" />
									<a class="fan2" href="<?=Yii::app()->createUrl('site/changePwd')?>">修改密碼</a>
								</td>
							</tr>
							<tr>
								<td width="165" height="30" align="left" valign="middle" nowrap="nowrap">暱稱 / Nickname：</td>
								<td valign="middle"><label for="textfield3"></label>
									<input name="nickname" type="text" id="nickname" value="<?=$model->nickname?>" size="30" /></td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">性別 / sex ：</td>
								<td valign="middle"><label>
										<input type="radio" name="sex" <?php if($model->sex==1){?> checked="checked"<?php }?> value="1" id="RadioGroup1_0" />
										男</label>
									<label>
										<input type="radio" name="sex" <?php if($model->sex==2){?> checked="checked"<?php }?>  value="2" id="RadioGroup1_1" />
										女</label></td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">血型 / Blood Type ：</td>
								<td valign="middle">
									<?php echo CHtml::dropDownList('blood',$model->blood, Yii::app()->params['blood']);?>
								</td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">*身份証號碼 / ID Number：</td>
								<td valign="middle"><label for="textfield4"></label>
									<input name="idcard" type="text" disabled="disabled" id="idcard" value="<?=$model->idcard?>" size="30" readonly="readonly" /></td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">* 出生年月日 / Birthday ：</td>
								<td valign="middle"><input type="text" id="birthday" name="birthday" value="<?=$model->birthday?>" size="30" /></td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">* E-mail ：</td>
								<td valign="middle"><label for="textfield5"></label>
									<input name="email" type="text" id="email" value="<?=$model->email?>" readonly="readonly" disabled="disabled" size="30" />
									<?php
									if(Yii::app()->params['emailVerify'] && !$model->email_status){
									?>
									<a href="###" onclick="reSentEmail()">重新發送驗證郵件</a>&nbsp;&nbsp;<a class="fan" href="<?=Yii::app()->createUrl('site/changeEmail')?>">更換郵箱</a>
									<?php
									}else{
									?>
									<a class="fan" href="<?=Yii::app()->createUrl('site/changeEmail')?>">更換郵箱</a>
									<?php
									}
									?>
									
								</td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">* 手機 / Mobile ：</td>
								<td valign="middle"><label for="textfield6"></label>
									<input name="mobile" type="text" id="mobile" value="<?=$model->mobile?>" size="30" />
								</td>
								<td valign="middle">&nbsp;</td>
								<td valign="middle">&nbsp;</td>
								<td valign="middle">&nbsp;</td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">郵遞區號 / Postal ：</td>
								<td valign="middle"><label for="textfield7"></label>
									<input name="postcode" type="text" id="postcode" value="<?=$model->postcode?>" size="30" /></td>
								<td valign="middle">&nbsp;</td>
								<td valign="middle">&nbsp;</td>
								<td valign="middle">&nbsp;</td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">*通訊地址 / Adress ：</td>
								<td valign="middle"><label for="textfield8"></label>
									<input name="address" type="text" id="address" value="<?=$model->address?>" size="48" /></td>
								<td valign="middle">&nbsp;</td>
								<td valign="middle">&nbsp;</td>
								<td valign="middle">&nbsp;</td>
							</tr>
						</table>
					</div>
					<div class="memberBOX"><span class="title01">進階資訊</span>
						<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
								<td width="165" height="30" align="left" valign="middle" nowrap="nowrap">職業   / Occupation   ：</td>
								<td valign="middle">
									<?php echo CHtml::dropDownList('occupation',$model->occupation, Yii::app()->params['occupation']);?>
								</td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">薪資   / Salary   ：</td>
								<td valign="middle">
									<?php echo CHtml::dropDownList('salary',$model->salary, Yii::app()->params['salary']);?>
								</td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">學歷   / Education：</td>
								<td valign="middle">
									<?php echo CHtml::dropDownList('education',$model->education, Yii::app()->params['education']);?>
								</td>
							</tr>
							<tr>
								<td height="30" align="left" valign="middle" nowrap="nowrap">婚姻   / Marital   status：</td>
								<td valign="middle"><label>
										<input type="radio" name="marital" <?php if($model->marital==1){?> checked="checked"<?php }?> value="1" id="RadioGroup2_0" />
										未婚</label>
									<label>
										<input type="radio" name="marital" <?php if($model->marital==2){?> checked="checked"<?php }?> value="2" id="RadioGroup2_1" />
										已婚</label></td>
							</tr>
							<tr>
								<td height="40" colspan="2" align="center" valign="middle" nowrap="nowrap"><input type="submit" name="button" id="button" value="儲存修改" /></td>
							</tr>
						</table>
					</div>
				</form>
			</div>
			<div class="mainContentBox"> </div>
			<div class="right_mainBox_bottom"></div>
		</div>
	</div>
</div>
